﻿
using System.Collections.Generic;
using System.ComponentModel;

namespace Enferno.Public.Web.Models
{

    public class VariantModel : VariantBaseModel<OnHandStatusModel, PriceModel, ProductFileModel, ParametricModel, ParametricValueModel>
    {
        
    }

    /// <summary>
    /// The Variant model keeps information about what is specific to the variant. Common data is at ProductModel level.
    /// </summary>
    public class VariantBaseModel<TOnHandStatusModel, TPriceModel, TProductFileModel, TParametricModel, TParametricValueModel>
        where TOnHandStatusModel: OnHandStatusModel
        where TPriceModel: PriceModel
        where TProductFileModel: ProductFileModel
        where TParametricModel: ParametricBaseModel<TParametricValueModel>
        where TParametricValueModel: ParametricValueModel
    {
        public VariantBaseModel()
        {
            Files = new List<TProductFileModel>();
            Flags = new List<int>();
            VariantParametrics = new List<TParametricModel>();
            Parametrics = new List<TParametricModel>();
        }

        public int Id { get; set; }
        /// <summary>
        /// The name of the variant
        /// </summary>
        public string Name { get; set; }
        public string PartNo { get; set; }
        public string ManufacturePartNo { get; set; }

        public TPriceModel Price { get; set; }

        public TOnHandStatusModel OnHandStatus { get; set; }
        public string ImageKey { get; set; }

        /// <summary>
        /// The ImageUrl is the Url to the image. It is resolved to an actual address but has no informationa about size. This has to be provided by the application.
        /// If Enferno's image server is used a preset neddds to be apended to the url by the application.
        /// </summary>
        public string ImageUrl { get; set; }

        /// <summary>
        /// Flags are variant specific flags. Common flags are kept at Product level. 
        /// </summary>
        public List<int> Flags { get; set; }

        /// <summary>
        /// Files are variant specific files. Common files are kept at Product level. 
        /// </summary>
        public List<TProductFileModel> Files { get; set; }

        /// <summary>
        /// VariantParametrics are the parameters that distingushes variante from each other.
        /// </summary>
        public List<TParametricModel> VariantParametrics { get; set; }

        /// <summary>
        /// Parameterics are the parameters that differ amongst variants, but still can be different amongst variants
        /// </summary>
        public List<TParametricModel> Parametrics { get; set; }
    }
}
